-
Notifications
You must be signed in to change notification settings - Fork 1.2k
DATAREDIS-471 - Add support for partial updates. #191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
public PartialUpdate<T> del(String path) { | ||
|
||
Assert.hasText(path, "Path to remove must not be null or empty!"); | ||
propertyUpdates.add(new PropertyUpdate(UpdateCommand.DEL, path)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PartialUpdate
changes its own state and creates a new instance.
296acd0
to
fb29ee3
Compare
@@ -393,6 +394,109 @@ public Long doInRedis(RedisConnection connection) throws DataAccessException { | |||
return count != null ? count.longValue() : 0; | |||
} | |||
|
|||
public void update(final PartialUpdate<?> update) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Old index references remain in index-helper index (entity):(key):idx
when updating/deleting @Indexed
properties
f35ef8a
to
51c17ca
Compare
Prepare issue branch.
We now allow partial update of domain types via PartialUpdate. The according expiration times and secondary index structures are updated accordingly. In some cases it is not necessary to load and rewrite the entire entity just to set a new value within it. A session timestamp for last active time might be such a scenario where you just want to alter one property. `PartialUpdate` allows to define `set`, `delete` actions on existing objects while taking care of updating potential expiration times of the entity itself as well as index structures. .Sample Partial Update ==== [source,java] ---- PartialUpdate<Person> update = new PartialUpdate<Person>("e2c7dcee", Person.class) .set("firstname", "mat") <1> .set("address.city", "emond's field") <2> .del("age"); <3> template.update(update); update = new PartialUpdate<Person>("e2c7dcee", Person.class) .set("address", new Address("caemlyn", "andor")) <4> .set("attributes", singletonMap("eye-color", "grey")); <5> template.update(update); update = new PartialUpdate<Person>("e2c7dcee", Person.class) .refreshTtl(true); <6> .set("expiration", 1000); template.update(update); ---- <1> Set the simple property _firstname_ to _mat_ <2> Set the simple property _address.city_ to _emond's field_ without having to pass in the entire object. This does not work when a custom conversion is registered. <3> Remove the property _age_. <4> Set complex property _address_. <5> Set a map/collection of values removes the previously existing map/collection and replaces the values with the given ones. <6> Automatically update the server expiration time when altering time to live. ==== NOTE: Updating complex objects as well as map/collection structures requires further interaction with Redis to determine existing values which means that it might turn out that rewriting the entire entity might be faster. Original pull request: #191.
Update reference documentation. Enhance JavaDoc. Remove destroy of managed bean. Refactor property update of writePartialUpdate into own method. Remove trailing whitespaces in JavaDoc. Original pull request: #191.
51c17ca
to
7209513
Compare
We now allow partial update of domain types via PartialUpdate. The according expiration times and secondary index structures are updated accordingly. In some cases it is not necessary to load and rewrite the entire entity just to set a new value within it. A session timestamp for last active time might be such a scenario where you just want to alter one property. `PartialUpdate` allows to define `set`, `delete` actions on existing objects while taking care of updating potential expiration times of the entity itself as well as index structures. .Sample Partial Update ==== [source,java] ---- PartialUpdate<Person> update = new PartialUpdate<Person>("e2c7dcee", Person.class) .set("firstname", "mat") <1> .set("address.city", "emond's field") <2> .del("age"); <3> template.update(update); update = new PartialUpdate<Person>("e2c7dcee", Person.class) .set("address", new Address("caemlyn", "andor")) <4> .set("attributes", singletonMap("eye-color", "grey")); <5> template.update(update); update = new PartialUpdate<Person>("e2c7dcee", Person.class) .refreshTtl(true); <6> .set("expiration", 1000); template.update(update); ---- <1> Set the simple property _firstname_ to _mat_ <2> Set the simple property _address.city_ to _emond's field_ without having to pass in the entire object. This does not work when a custom conversion is registered. <3> Remove the property _age_. <4> Set complex property _address_. <5> Set a map/collection of values removes the previously existing map/collection and replaces the values with the given ones. <6> Automatically update the server expiration time when altering time to live. ==== NOTE: Updating complex objects as well as map/collection structures requires further interaction with Redis to determine existing values which means that it might turn out that rewriting the entire entity might be faster. Original pull request: #191.
Update reference documentation. Enhance JavaDoc. Remove destroy of managed bean. Refactor property update of writePartialUpdate into own method. Remove trailing whitespaces in JavaDoc. Original pull request: #191.
That's merged with addcdfe. |
We now allow partial update of domain types via PartialUpdate. The according expiration times and secondary index structures are updated accordingly. In some cases it is not necessary to load and rewrite the entire entity just to set a new value within it. A session timestamp for last active time might be such a scenario where you just want to alter one property. `PartialUpdate` allows to define `set`, `delete` actions on existing objects while taking care of updating potential expiration times of the entity itself as well as index structures. .Sample Partial Update ==== [source,java] ---- PartialUpdate<Person> update = new PartialUpdate<Person>("e2c7dcee", Person.class) .set("firstname", "mat") <1> .set("address.city", "emond's field") <2> .del("age"); <3> template.update(update); update = new PartialUpdate<Person>("e2c7dcee", Person.class) .set("address", new Address("caemlyn", "andor")) <4> .set("attributes", singletonMap("eye-color", "grey")); <5> template.update(update); update = new PartialUpdate<Person>("e2c7dcee", Person.class) .refreshTtl(true); <6> .set("expiration", 1000); template.update(update); ---- <1> Set the simple property _firstname_ to _mat_ <2> Set the simple property _address.city_ to _emond's field_ without having to pass in the entire object. This does not work when a custom conversion is registered. <3> Remove the property _age_. <4> Set complex property _address_. <5> Set a map/collection of values removes the previously existing map/collection and replaces the values with the given ones. <6> Automatically update the server expiration time when altering time to live. ==== NOTE: Updating complex objects as well as map/collection structures requires further interaction with Redis to determine existing values which means that it might turn out that rewriting the entire entity might be faster. Original pull request: #191.
Update reference documentation. Enhance JavaDoc. Remove destroy of managed bean. Refactor property update of writePartialUpdate into own method. Remove trailing whitespaces in JavaDoc. Original pull request: #191.
We now allow partial update of domain types via PartialUpdate. The according expiration times and secondary index structures are updated accordingly.
In some cases it is not necessary to load and rewrite the entire entity just to set a new value within it. A session timestamp for last active time might be such a scenario where you just want to alter one property.
PartialUpdate
allows to defineset
,delete
actions on existing objects while taking care of updating potential expiration times of the entity itself as well as index structures.NOTE: Updating complex objects as well as map/collection structures requires further interaction with Redis to determine existing values which means that it might turn out that rewriting the entire entity might be faster.